package mylittleinvestigations.Events;

import java.util.ArrayList;
import mylittleinvestigations.GameUi.ImageButton;

public class ImageButtonEventProvider
{
    private static ArrayList<ImageButtonEventListener> listenerList = new ArrayList<ImageButtonEventListener>();
    
    public static void RegisterListener(ImageButtonEventListener listener)
    {
        if (!listenerList.contains(listener))
        {
            listenerList.add(listener);
        }
    }
    
    public static void ClearListener(ImageButtonEventListener listener)
    {
        listenerList.remove(listener);
    }
    
    public static void RaiseClicked(ImageButton sender)
    {
        for (int i = 0; i < listenerList.size(); i++)
        {
            listenerList.get(i).OnButtonClicked(sender);
        }
    }
}
